package com.zxw.hotel.api;

import com.zxw.hotel.model.Total;
import com.zxw.hotel.service.TotalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/v1/total")
public class TotalApi {
    private TotalService totalService;
    @Autowired
    public TotalApi(TotalService totalService) {
        this.totalService = totalService;
    }
    @GetMapping
    public Map<String,Object> getTotal() {
        List<Total> all = totalService.findAll();
        return Map.of("success",true,"data",all);
    }
    @PostMapping
    public Map<String,Object> getquxian() {
        List<Total> selectquxain = totalService.selectquxain();
        return Map.of("success",true,"data",selectquxain);
    }
}
